<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:wh="http://java.sun.com/jsf/composite/wh"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template/template.xhtml">
		<ui:define name="content">
			<h:form id="form" styleClass="horizontal_full">
					<p:panel>
							<h1>Supplier Management</h1>
							<p>
								Allows you to configure, add and delete different suppliers that are used in the whole game. In the product management site you can assign different products to this suppliers.
							</p>
							<p:dataTable id="supplierTable" var="supplier"
							 value="#{adminMBean.allSuppliers()}" rowKey="#{supplier.supplierName}"
							 paginatorTemplate="{RowsPerPageDropdown} {CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
	                 		 rowsPerPageTemplate="10,25,50,100" paginator="true" rows="100">
							    <f:facet name="header">
						            Supplier Overview
						        </f:facet>
							    
							    <p:column headerText="Name" sortBy="#{supplier.supplierName}">
							        <h:outputText value="#{supplier.supplierName}" />
							    </p:column>
							    
							    <!-- 
							    <p:column headerText="Discount per 10 Units" sortBy="#{supplier.discountPerTenUnits}">
							        <h:outputText value="#{supplier.discountPerTenUnits}" />
							    </p:column>
							    
							    <p:column headerText="Delivery Costs" sortBy="#{supplier.deliveryCost}">
							        <h:outputText value="#{supplier.deliveryCost}" />
							    </p:column>
							     -->
							     
							    <p:column headerText="Active" sortBy="#{supplier.active}}">
							        <p:outputPanel layout="inline" styleClass="ui-icon ui-icon-circle-check" rendered="#{supplier.active}" />
									<p:outputPanel layout="inline" styleClass="ui-icon ui-icon-circle-close" rendered="#{!supplier.active}" />
							    </p:column>
							    
							    <p:column headerText="Configure Supplier">
									<p:commandButton icon="ui-icon-gear" title="Configure" update="supplierTable"
										action="#{adminMBean.actionGoToUpdateSupplier()}">
										<f:setPropertyActionListener value="#{supplier}"
											target="#{adminMBean.selectedSupplier}" />
									</p:commandButton>
								</p:column>
						        
						        <!-- 
						        <p:column headerText="Delete Supplier">
									<p:commandButton icon="ui-icon-circle-minus" title="Delete"
										action="#{adminMBean.actionDeleteSupplier()}"
										update="supplierTable">
										<f:setPropertyActionListener value="#{supplier}"
											target="#{adminMBean.selectedSupplier}" />
									</p:commandButton>
								</p:column>
						         -->
						        		    
							    <f:facet name="footer">
							    	<p:commandButton value="Reload" action="#{adminMBean.actionRefreshAllSuppliers()}" update="supplierTable" icon="ui-icon-refresh"/>
									<p:commandButton value="Create New Supplier" action="#{adminMBean.actionGoToCreateSupplier()}" update="supplierTable" icon="ui-icon-circle-plus"/>
						        </f:facet>
							</p:dataTable>
							
							<br></br>
							
							<br></br>
							<!--  
							<h3 style="margin-top: 0">User zu Spiel hinzufügen</h3>
							<p:pickList showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains" 
							id="pickList" value="#{adminMBean.usersPickList}" var="user" itemLabel="#{user.nickname}" itemValue="#{user}" />
							-->
							
					</p:panel>
				</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>